package com.lenovo.manufacture.Adapter;

import android.annotation.SuppressLint;
import android.os.Build;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.recyclerview.widget.RecyclerView;

import com.lenovo.manufacture.R;

import org.w3c.dom.Text;

import java.util.List;

public class recAdapter extends RecyclerView.Adapter<recAdapter.viewHolder> {
    List<String> list;

    public recAdapter(List<String> list) {
        this.list = list;
    }

    @NonNull
    @Override
    public viewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        TextView textView =new TextView(parent.getContext(), null, 0, R.style.adaptertext);
        return new viewHolder(textView);
    }

    @Override
    public void onBindViewHolder(@NonNull viewHolder holder, int position) {
        holder.textView.setText(list.get(position));
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class viewHolder extends RecyclerView.ViewHolder {
        TextView textView;

        public viewHolder(@NonNull View itemView) {
            super(itemView);
            textView = ((TextView) itemView);
        }
    }
}
